/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package csse3004.GD.WBUser;

import csse3004.GD.DA.WBUserDA;
import java.lang.String;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.SimpleFormController;
import org.springframework.web.servlet.view.RedirectView;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 *
 * @author s4223901 Lan YE
 */
public class feedbackController extends SimpleFormController{
  //  private WBUserService WBUserService = new WBUserDA();
    private WBUserDA service = new WBUserDA();
    protected final Log log = LogFactory.getLog(getClass());
    
    @Override
    public ModelAndView onSubmit(Object command) {
        logger.info("test");
        feedback feedback = (feedback) command;
        String ftext = feedback.gettext();
        int questionid = feedback.getqid();
        service.sendFeedback(ftext, questionid);      
        logger.info("feedback: " + ftext);
        logger.info("questionid: " + questionid);
        ModelAndView modelAndView = new ModelAndView(new RedirectView(getSuccessView()));
        //modelAndView.addObject("feedback", command);
        
        return modelAndView;
    }
}
